var username = document.getElementsByClassName('username')[0],
    nextBtn = document.getElementsByClassName('nextBtn')[0],
    male = document.getElementById('male');
male.onclick = function () {
    if(male.checked) console.log(male.value);
};
//    昵称
function name(val, btn) {
    val.oninput = function () {
        if(val.value.length > 0){
            btn.style.cssText = 'background: #FA53AD;';
        }else {
            btn.style.cssText = 'background: #ccc;';
        }

    };
    val.onchange = function () {
        new Alert({
            hint: '提示',
            condition:'性别选定后将不能更改',
            leftText: '确认',
            rightText: '确认',
            successFn: function () {},
            faillFn: function () {}
        });
        btn.onclick = function () {
            ajax({
                method:'post',
                url:'http://localhost:8080/register',
                data:{
                    validCode:'9999',
                    username:username.value,
                    step:'2'
                },
                dataType:'json',
                contentType:'json',
                success:function (data) {
                    if(data.code === 1){
                        window.location.href = "./portrait.html";
                    }else {
                        console.log(data);
                    }
                },
                fail:function (error) {
                    console.log(error);
                }
            });
        };
    };

}
name(username, nextBtn);
//   性别



